package com.back_end.Lambda;
/*
*
* 推导lambda表达式
*
* */
public class TestLambda1 {

    // 3.静态内部类
    static class Like1 implements ILike{
        @Override
        public void lambda() {
            System.out.println("静态内部类::--->lambda");
        }
    }




    public static void main(String[] args) {
        ILike like = new Like();
        like.lambda();

        Like1 like1 = new Like1();
        like1.lambda();


        // 4.局部内部类
         class Like2 implements ILike{
            @Override
            public void lambda() {
                System.out.println("局部内部类::--->lambda");
            }
        }

        ILike like2 = new Like2();
         like2.lambda();



         // 5.匿名内部类,没有类的名称,必须借助接口,父类
        ILike like3 = new ILike(){
            @Override
            public void lambda(){
                System.out.println("匿名内部类::--->lambda");
            }
        };

        like3.lambda();


        // 6.用lambda简化
        ILike like4 = new Like();
        like4 = ()->{
            System.out.println("lambda5::--->lambda");
        };



    }
}

// 1.定义一个函数式接口
interface ILike{
    void lambda();
}

// 2.实现类
class Like implements ILike{
    @Override
    public void lambda() {
        System.out.println("实现类::--->lambda");
    }
}





